package cn.kgc.easybuy.utils;

import java.util.HashMap;

public class AjaxResult extends HashMap<String,Object> {
    private AjaxResult(){}

    public AjaxResult add(String key,Object value){
        this.put(key,value);
        return this;
    }

    public static AjaxResult success(){
        return new AjaxResult().add("code",5200).add("msg","===成功===");
    }

    public static AjaxResult error(){
        return new AjaxResult().add("code",5500).add("msg","===失败===");
    }

    public static AjaxResult error(int code,String msg){
        return new AjaxResult().add("code",code).add("msg",msg);
    }
}
